<template>
	<view class="wrap">
		<view class="goodsWrap" v-for="item in indexGoodslist" :key="item.id">
			<view class="title">
				<image :src="item.titleImg" mode="widthFix"></image>
			</view>
			<view class="main">
				<view class="item" v-for="item1 in item.childInfo" :key="item1.goods_id" @click="handleDetail(item1.goods_id)">
					<view class="pic">
						<image :src="item1.goodsUrl" mode="widthFix"></image>
					</view>
					<view class="info">
						<view class="goodsName">{{item1.goodsName}}</view>
						<view class="goodsDesc">{{item1.goodsDesc}}</view>
						<view class="goodsPrice">{{item1.goodsPrice}}</view>
						<view class="quickB">立即购买</view>
					</view>
				</view>
			</view>
		</view>
		<view class="line"></view>
	</view>
</template>

<script>
	export default {
		name:"uni-index-goods",
		props:{
			indexGoodslist:Array
		},
		data() {
			return {
				
			};
		},
		methods:{
			handleDetail(id){
				uni.navigateTo({
					url:"../../pages/deatil/deatil?goods_id="+id
				})
			}
		}
	}
</script>

<style lang="less">
.wrap{
	.line{width: 100%;height: 16rpx;background-color: #e1e1e1;}
	.goodsWrap{
		.title{
			image{
				width: 100%;
			}
		}
		.main{
			display:flex;
			flex-wrap: wrap;
			.item{
				width: 50%;
				padding: 0 10rpx;
				.pic{
					width: 100%;
					image{
						width: 100%;
					}
				}
				.info{
					display: flex;
					flex-direction: column;
					align-items: center;
					.goodsDesc{
						text-overflow: ellipsis;
						overflow: hidden;
						white-space: nowrap;
						width: 90%;
						color: gray;
					}
					.goodsPrice{
						color: red;
					}
					.quickB{
						width: 200rpx;
						height: 60rpx;
						border-radius: 10rpx;
						background-color: red;
						color: white;
						text-align: center;
						line-height: 60rpx;
					}
				}
			}
		}
	}
}
</style>
